import react,{useState} from 'react'
function Dog(){
    let [isBarking,setIsBarking]=useState(false)
    let [isRuning,setIsRuning]=useState(false)
   const handleClick=()=>{
    //    DOM 编程已经一去不复返了
setIsBarking(true)
setIsRuning(true)
setTimeout(()=>{
setIsBarking(false)
setIsRuning(false)
},2000)
    }
    return(
        <div onClick={handleClick}>
             <div>Dog</div>
             <p>{isBarking&&'汪汪汪'}</p>
             <p>{isRunning && 'runrun'}</p>
        </div>
       
    )
} 
export default Dog